﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		Comment.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            Comment.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion
 
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net.Mail;
using Dexter.Domain.Contracts;

namespace Dexter.Domain.Model {
	public partial class Comment : EntityBase, IFeedItem {
		protected Comment ( ) {
			Comments = new List <Comment> ( );
		}

		internal Comment(Item item, string message, string name, MailAddress email, Uri webSite) : this(item, message, name, email, webSite, null) { }

		internal Comment(Item item, string message, string name, MailAddress email, Uri webSite, Comment parent)
			: this ( ) {
			Item = item;
			Message = message;
			Name = name;
			Email = email;
			WebSite = webSite;
			Parent = parent;
		}

		public virtual Item Item { get; set; }
		public virtual string Message { get; set; }
		public virtual string Name { get; set; }
		public virtual MailAddress Email { get; set; }
		public virtual bool Notify { get; set; }
		public virtual Uri WebSite { get; set; }
		public virtual bool Approved { get; set; }
		public virtual bool IsSpam { get; set; }
		public virtual CultureInfo Culture { get; set; }
		public virtual Comment Parent { get; set; }
		public virtual IEnumerable<Comment> Comments { get; protected set; }

		/// <summary>
		/// 	Gets the feed item title.
		/// </summary>
		/// <value>The feed item title.</value>
		public virtual string FeedItemTitle {
			get { return this.Item.Title; }
		}

		/// <summary>
		/// 	Gets the feed item description.
		/// </summary>
		/// <value>The feed item description.</value>
		public virtual string FeedItemDescription {
			get { return this.Message; }
		}

		/// <summary>
		/// 	Gets the feed item author.
		/// </summary>
		/// <value>The feed item author.</value>
		public virtual string FeedItemAuthor {
			get { return this.Name; }
		}

		/// <summary>
		/// 	Gets the feed item publish date in <c>Coordinated Universal Time</c>.
		/// </summary>
		/// <value>The feed item publish date UTC.</value>
		public virtual DateTime FeedItemPublishDateUtc {
			get { return this.CreationDate.ToUniversalTime (  ); }
		}

		/// <summary>
		/// 	Gets the feed item categories.
		/// </summary>
		/// <value>The feed item categories.</value>
		public virtual string[] FeedItemCategories {
			get { return new string[0]; }
		}

		/// <summary>
		/// 	Gets the feed item owner.
		/// </summary>
		/// <value>The feed item owner.</value>
		public virtual Item FeedItemOwner {
			get { return this.Item; }
		}
	}
}
